package com.At;



import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;

import com.opensymphony.xwork2.ActionSupport;
import java.util.*;

public class SetupAt extends ActionSupport implements ServletRequestAware,ServletResponseAware {

private static final long serialVersionUID = 1L;
		
	
	protected HttpServletRequest 	req = null;
	protected HttpServletResponse 	res = null;	
	
	
	
	public void setServletResponse(HttpServletResponse arg0) {
		this.res = arg0;
	}
	public void setServletRequest(HttpServletRequest arg0) {
		this.req = arg0;
	}
	

	
	public Map<String, Object> getParameterNameAndValueMap()
	  {
		 
	    Map map = new HashMap();
	    Enumeration paramNames = this.req.getParameterNames();

	    while (paramNames.hasMoreElements()){
	      String paramName = (String)paramNames.nextElement();
	      String[] paramValueL = this.req.getParameterValues(paramName);
	      String paramValue = paramValueL[0];

	      map.put(paramName, paramValue);
	    }

	    return map;
	  }


	

	
	  public Map<String, Object> getParameterNamesAndValuesMap()
	  {
		  
		  
	    Map map = new HashMap();
	    Enumeration paramNames = this.req.getParameterNames();

	    while (paramNames.hasMoreElements()) {
	      String paramName = (String)paramNames.nextElement();
	      String[] paramValueL = this.req.getParameterValues(paramName);
	      String paramValue = paramValueL[0];

	      map.put(paramName, paramValue);
	      map.put("arr_" + paramName, paramValueL);
	    }

	    return map;
	  }

}
